package com.yanqu.road.server.cmd.activity.zhenhuan.secondProcess;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ZhenHuanProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.zhenhuan.ZhenHuanSecondProcessModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_ZHENHUAN_SECOND_PROCESS_RELATION_LIST, desc = "甄嬛第二阶段关系列表")
public class ZhenHuanSecondProcessRelationListCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ZhenHuanProto.ZhenHuanSecondProcessRelationListReqMsg reqMsg = ZhenHuanProto.ZhenHuanSecondProcessRelationListReqMsg.parseFrom(packet.getBytes());
        ret = player.getModule(ZhenHuanSecondProcessModule.class).getRelationList(reqMsg);
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret > 0) {
            player.sendPacket(ClientProtocol.U_ZHENHUAN_SECOND_PROCESS_RELATION_LIST, ZhenHuanProto.ZhenHuanSecondProcessRelationListRespMsg.newBuilder().setRet(ret));
        }
    }

}
